<?php

namespace App\Library\Common\Push;

use App\Library\Common\Push\ThirdPush\HonorPush;
use App\Library\Common\Push\ThirdPush\HuaweiPush;
use App\Library\Common\Push\ThirdPush\XiaomiPush;
use App\Library\Common\Singleton;
use App\Models\Common\CommonPushBindModel;
use Exception;

class KfPushFactory extends Singleton
{
    /**
     * @param int $mobileBrand
     * @return HonorPush|HuaweiPush|XiaomiPush|mixed
     * @throws Exception
     */
    public function getFactory(int $mobileBrand)
    {
        switch ($mobileBrand) {
            case CommonPushBindModel::MOBILE_BRAND_1:
                return XiaomiPush::getInstance();
                break;
            case CommonPushBindModel::MOBILE_BRAND_2:
                return HuaweiPush::getInstance();
                break;
            case CommonPushBindModel::MOBILE_BRAND_3:
                return HonorPush::getInstance();
                break;
            default:
                throw new Exception("手机品牌厂商错误 [ {$mobileBrand} ]");
                break;
        }
    }
}
